<!--
 * @Description: 节点追加
 * @Author: rendc
 * @Date: 2021-09-07 09:19:14
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-07 09:27:38
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>节点追加</title>
</head>

<body>
  <div class="parent">
    <div class="child">1</div>
    <div class="child">2</div>
    <div class="child">3</div>
    <div class="child">4</div>
  </div>
</body>
<script>
  // var myDiv = document.createElement('div');
  // myDiv.innerText = "5";
  var rootDiv = document.getElementsByClassName('parent')[0];
  var firstDiv = document.getElementsByClassName('child')[0];
  rootDiv.appendChild(firstDiv);
</script>

</html>